package vip.mtdp.asset.core.dto;

import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * @Description
 * @Author Evans.wang
 * @since 2023/10/29 14:35
 **/
@Data
public class JournalDTO implements Serializable {
    private static final long serialVersionUID = 1L;

    private Long id;

    private Long txnId;

    private String bizType;
    private String journalType;

    /**
     * 0=单边记账
     * 1=复试记账
     */
    private Integer doubleEntry;

    /**
     * instant=交易发生时，同步实时记账
     * delay=交易发生后，系统延迟记账
     * trigger=交易发生后，外部触发记账
     */
    private String postingMethod;

    /**
     * 1=初始化，2=处理成功，3=处理中，31=等待异步记账，4=失败
     */
    private Integer postingState;

    private Integer seq;

    private Date accountingDate;

    private List<JournalItemDTO> journalItemDTOList;

    @Data
    public static class JournalItemDTO implements Serializable{

        private static final long serialVersionUID = 1L;

        private Long id;

        private Long journalId;
        private Long accountId;

        private String coin;
        private BigDecimal amount;

        /**
         * dr = debit record
         * cr = credit record
         */
        private String drCr;

        private BigDecimal openBalance;
        private BigDecimal closeBalance;

    }

}
